<div class="left-side sticky-left-side">

        <!--logo and iconic logo start-->
        <div class="logo">
            <a href="index.html"><img src="images/logo.png" alt=""></a>
        </div>

        <div class="logo-icon text-center">
            <a href="index.html"><img src="images/logo_icon.png" alt=""></a>
        </div>
        <!--logo and iconic logo end-->

        <div class="left-side-inner">

            <!-- visible to small devices only -->
            <!--sidebar nav start-->
            <ul class="nav nav-pills nav-stacked custom-nav" id="index_aside_id">
            </ul>
            <!--sidebar nav end-->

        </div>
    </div>
	
	<script type="text/javascript">
	
	
	//通过ajax获取按钮信息
	
	window.onload = function(){
	
		$.ajax({
			type:'post',
			url:'/admin/public/get_menu',
			data:{},
			success:function(data){	
				$('#index_aside_id').html(make_tree(data));
				jQuery('.menu-list > a').click(function() {
				  var parent = jQuery(this).parent();
				  var sub = parent.find('> ul');
				  
				  if(!jQuery('body').hasClass('left-side-collapsed')) {
					 if(sub.is(':visible')) {
						sub.slideUp(200, function(){
						   parent.removeClass('nav-active');
						   jQuery('.main-content').css({height: ''});
						   mainContentHeightAdjust();
						});
					 } else {
						visibleSubMenuClose();
						parent.addClass('nav-active');
						sub.slideDown(200, function(){
							mainContentHeightAdjust();
						});
					 }
				  }
				  return false;
				});
				
				function visibleSubMenuClose() {
				  jQuery('.menu-list').each(function() {
					 var t = jQuery(this);
					 if(t.hasClass('nav-active')) {
						t.find('> ul').slideUp(200, function(){
						   t.removeClass('nav-active');
						});
					 }
				  });
				}
				
				function mainContentHeightAdjust() {
				  // Adjust main content height
				  var docHeight = jQuery(document).height();
				  if(docHeight > jQuery('.main-content').height())
					 jQuery('.main-content').height(docHeight);
				}
			},
			error:function(){alert('数据传输错误！');}
			});
			
			function make_tree(data){
				var new_data = [];
				var str = '';
				for(var i=0;i<data.length;i++){
					if(0 == data[i]['pid']){
						new_data.push(data[i]);
						data.splice(i,1);
						i--;
					}
				}
				
				//取子级
				if(new_data.length>0){
					for(var k=0;k<new_data.length;k++){			
						var newdata = get_child(data,new_data[k]['id']);
						if(newdata.length > 0){
							str += '<li class="menu-list">';
							str += '<a href="/admin/'+new_data[k]['url']+'"><i class="fa '+new_data[k]['icon']+'"></i> <span>'+new_data[k]['name']+'</span></a>';
							//判断是否有下级
							str += '<ul class="sub-menu-list">';
							for(var s=0;s<data.length;s++){
								if(data[s]['pid'] == new_data[k]['id']){
									str += '<li><a href="/admin/'+data[s]['url']+'">'+data[s]['name']+'</a></li>';
								}
							}
							str += '</ul></li>';
						}else{
							str += '<li class="">';
							str += '<a href="/admin/'+new_data[k]['url']+'"><i class="fa '+new_data[k]['icon']+'"></i> <span>'+new_data[k]['name']+'</span></a></li>';
						}		
					}
				}
				return str;
			};
			
			//取出所有下级列
			function get_child(data,id){
				var new_data = [];
				for(var i=0;i<data.length;i++){
					if(data[i]['pid'] == id){
						new_data.push(data[i]);
					}
				}
				return new_data;
			}
	}
	
	
	
	
	

	</script>